/*
 * claplan_header.cc
 *
 *  Created on: 3 Nov 2013
 *      Author: Tom Vercauteren
 */

#include "claplan_header.h"

ClaplanHeader::ClaplanHeader(const ClaplanHeader &header)
{
	if (this != &header) *this = header;
}

ClaplanHeader& ClaplanHeader::operator=(const ClaplanHeader &header)
{
	if (this != &header)
	{
		mask = header.mask;
		version = header.version;
		mode = header.mode;
	}
	return *this;
}

int ClaplanHeader::getMode() const
{
	return mode;
}

void ClaplanHeader::setMode(int mode)
{
	this->mode = mode;
	mask.mode = 1;
}

void ClaplanHeader::unsetMode()
{
	mode = 0;
	mask.mode = 0;
}
unsigned char ClaplanHeader::isModeSet() const
{
	return mask.mode;
}

int ClaplanHeader::getVersion() const
{
	return version;
}

void ClaplanHeader::setVersion(int version)
{
	this->version = version;
	mask.version = 1;
}

void ClaplanHeader::unsetVersion()
{
	version = 0;
	mask.version = 0;
}

unsigned char ClaplanHeader::isVersionSet() const
{
	return mask.version;
}
std::ostream & operator<<(std::ostream & os, const ClaplanHeader &header)
{
	if (header.isVersionSet() & 1)
		print_kv<string, int>(os, "version", header.version);
	if (header.isModeSet() & 1) print_kv<string, int>(os, "mode", header.mode);
	return os;
}

